﻿using System;
using System.Collections.Generic;
using CommonLibrary.Helpers;

namespace CommonLibrary.Models.Profiles
{
    public class ProcessedProfile
    {
        public string ProfileName;
        public string ProfileDescription;

        public List<ProfileConfig> Configs = new List<ProfileConfig>();

        private Dictionary<string, SepcialAction> _configAction;
        public Dictionary<string, SepcialAction> ConfigAction
        {
            get { return _configAction ?? (_configAction = new Dictionary<string, SepcialAction>()); }
            set { _configAction = value; }
        }
    }

    public class ProfileConfig : ViewModel
    {
        public int Id { get; set; }

        private ObservableDictionary<string, AxisConfig> _axisAction;
        public ObservableDictionary<string, AxisConfig> AxisAction
        {
            get { return _axisAction ?? (_axisAction = new ObservableDictionary<string, AxisConfig>()); }
            set { _axisAction = value; OnPropertyChanged("AxisAction"); }
        }

        private Dictionary<string, string> _buttonActions;
        public Dictionary<string, string> ButtonActions
        {
            get { return _buttonActions ?? (_buttonActions = new Dictionary<string, string>()); }
            set { _buttonActions = value; }
        }

        private Dictionary<string, SepcialAction> _specialActions;
        public Dictionary<string, SepcialAction> SpecialActions
        {
            get { return _specialActions ?? (_specialActions = new Dictionary<string, SepcialAction>()); }
            set { _specialActions = value; }
        }
    }

    public class SepcialAction
    {
        public string ActionName { get; set; }
        public object Target { get; set; }
        public object Parameter { get; set; }
    }

    public class AxisConfig : ViewModel
    {
        private string _actionName;
        public string ActionName
        {
            get { return _actionName; }
            set { _actionName = value; OnPropertyChanged("ActionName"); }
        }

        private double _deadZone;
        public double DeadZone
        {
            get { return _deadZone; }
            set { _deadZone = value; OnPropertyChanged("DeadZone"); }
        }

        private double _multiplier;
        public double Multiplier
        {
            get { return _multiplier; }
            set { _multiplier = value; OnPropertyChanged("Multiplier"); }
        }

        private double _exponent;
        public double Exponent
        {
            get { return _exponent; }
            set { _exponent = value; OnPropertyChanged("Exponent"); }
        }

        private ShapeOfDeadZone _shape;
        public ShapeOfDeadZone Shape
        {
            get { return _shape; }
            set { _shape = value;
            OnPropertyChanged("Shape");}
        }
    }
}
